package cn.scxy.bookcity.controller;

import cn.scxy.bookcity.pojo.vo.ImgsListItemVO;
import cn.scxy.bookcity.service.IImgsService;
import cn.scxy.bookcity.web.JsonResult;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 用户首页的控制器
 *
 * @author zzr
 */
@RestController
@RequestMapping("/imgs")
@Api(tags = "商品图片模块")
@Slf4j
public class ImgsController {
    @Autowired
    private IImgsService iImgsService;

    @ApiOperation("根据商品id查询商品图片")
    @ApiOperationSupport(order = 300)
    @GetMapping("/queryImgs/{id}")
    public JsonResult<List<ImgsListItemVO>> queryPress1(@PathVariable Long id) {
        System.out.println("商品id---------" + id);
        List<ImgsListItemVO> imgsListItemVOS = iImgsService.selectListByGid(id);
        log.debug("查询到:{}条评论", imgsListItemVOS);
        return JsonResult.ok(imgsListItemVOS);
    }
}